package day06;

/*
 * Author: JacksonCoder
 * FileName: SelfExceptionDemo
 * Version: 1.0.0
 * Date: 2025/4/13
 */

class AgeTooSmallException extends Exception{

    public AgeTooSmallException(String message){
        super(message);
    }
}

public class SelfExceptionDemo {

    public static void main(String[] args) throws AgeTooSmallException {
        register(515);
    }

    public static void register(int age) throws AgeTooSmallException{
        if(age < 18){
            throw new AgeTooSmallException("年龄必须大于18");
        }
        System.out.println("注册成功！");
    }

}
